import { post } from '../http'
// -------------------------------结算报告-----------------------------

// 结算报告列表
export const settlementReportFind = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/Finance.AmzSettlement.SettlementReportFind', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
// 完成结算报告
export const saveSettlementStatus = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/saveSettlementStatus', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 申请报告
export const sendMqTask = async (paylaod?: any) => {
  return await post('https://erpapi.selleroa.com/v1/jsapi/main/sys/conf/sendMqTask', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 设置市场
export const saveSettlementMarketplace = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/saveSettlementMarketplace', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 结算报告明细列表
export const SettlementItemFind = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/Finance.AmzSettlement.SettlementItemFind', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
// 结算报告明细分配信息
export const AmzSettlementFeeAllocItemAgg = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/Finance.AmzSettlement.FeeAllocItemAgg', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}

export const AmzSettlementSettlementReservedStatus = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/Finance.AmzSettlement.SettlementReservedStatus', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const AmzSettlementAllocItemFind = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/Finance.AmzSettlement.AllocItemFind', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const FindShopId = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/Sys.Shop.FindShopId', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const FindShopUsers = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/User.ShopUser.FindShopUser', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}

export const SalesAmountAggBySellerInfo = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/Finance.AmzSettlement.SalesAmountAggBySellerInfo', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const saveSettlementFeeAllocManual = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/saveSettlementFeeAllocManual', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const saveSettlementFeeAllocItem = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/saveSettlementFeeAllocItem', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const saveSettlementItemManualAllocStatus = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/saveSettlementItemManualAllocStatus', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const saveSettlementItemSalesman = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/saveSettlementItemSalesman', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const saveSettlementItemSumType = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/saveSettlementItemSumType', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const saveSettlementItemSku = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/saveSettlementItemSku', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}

export const SalesmanAggFind = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/Finance.AmzSettlement.SalesmanAggFind', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const SettlementTotalAmountCheckStatus = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/Finance.AmzSettlement.TotalAmountCheckStatus', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}

export const ListSettlementItem = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/Finance.AmzSettlement.FindReportItem', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
// -------------------------------广告发票-----------------------------

// 广告发票列表
export const invoiceFind = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/find', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const salesmanAmtCount = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/item/salesman/amt', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const adjustmentsFind = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/adjustments/find', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const accItemFind = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/acc/item/find', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}

export const pullInvoiceItem = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/request/post_pull_invoice_item', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const adjustmentsAdd = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/adjustments/item/add', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const checkShopSpStatus = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/pull_first_page_invoice', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const confirmCheck = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/checked', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const undoCheck = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/checked/undo', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const itemFind = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/item/find', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const batchUpdateCampaignSalesman = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/item/campaign/salesman/batchupdate', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const salesmanAggV2Find = async (paylaod?: any) => {
  return await post('/finance/v1/bigdata/select/data/Finance.AmzInvoice.SalesmanAggFind', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const updateCampaignSalesman = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/item/campaign/salesman/update', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
export const adjustmentsDistribution = async (paylaod?: any) => {
  return await post('/innererp/ext/finance/ad/v1/invoice/adjustments/distribution', paylaod, { isFilterData: true })
    .then((res) => res)
    .catch(() => false)
}
